import request from '@/utils/request'

//API常量
const APIS = {
    V1: "/v1"
}

export function listProject(data) {
    return request({
        url: APIS.V1 + `/system/project/listProject`,
        method: 'post',
        data
    })
}

// 已进件接口
export function entryList(data) {
    return request({
        url: APIS.V1 + `/system/project/entryList`,
        method: 'post',
        data
    })
}
// 待进件接口
export function waitList(data) {
    return request({
        url: APIS.V1 + `/system/project/waitList`,
        method: 'post',
        data
    })
}

export function createProject(data) {
    return request({
        url: APIS.V1 + `/system/project/saveProjectInfo`,
        method: 'post',
        data
    })
}

export function createProjectInfoDraft(data) {
    return request({
        url: APIS.V1 + `/system/project/saveProjectInfoDraft`,
        method: 'post',
        data
    })
}


export function updateProject(data) {
    return request({
        url: APIS.V1 + `/system/project/updateProjectInfo`,
        method: 'post',
        data
    })
}

export function getByIdCardNo(idCardNo) {
    return request({
        url: APIS.V1 + `/system/client/findByIdCardNo`,
        method: 'get',
        params: idCardNo
    })
}

export function deleteUserById(param) {
    return request({
        url: APIS.V1 + `/system/project/delete`,
        method: 'get',
        params: param
    })
}

export function findProjectBytId(projectId) {
    return request({
        url: APIS.V1 + `/system/project/findByProjectId`,
        method: 'get',
        params: projectId
    })
}

export function findByBorrowerId(borrowerId) {
    return request({
        url: APIS.V1 + `/system/project/findByBorrowerId`,
        method: 'get',
        params: borrowerId
    })
}

// 项目审批历史接口
export function getApprovalHistory(param) {
    return request({
        url: APIS.V1 + `/system/project/getApprovalHistory`,
        method: 'get',
        params: param
    })
}

// 提交项目
export function submitProject(projectId) {
    return request({
        url: APIS.V1 + `/system/project/submitProject?projectId=` + projectId,
        method: 'GET'
    })
}

// 开启任务
export function startTask(projectId) {
    return request({
        url: APIS.V1 + `/system/project/startTask?projectId=` + projectId,
        method: 'GET'
    })
}


// 查询用户
export function listUserByRole(roleName) {
    return request({
        url: APIS.V1 + `/system/user/listUserByRole?roleName=` + roleName,
        method: 'GET'
    })
}
// 任务初审
export function firstCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/firstCheck`,
        method: 'POST',
        data: data
    })
}
// 备份项目
export function backProject(projectId) {
    return request({
        url: APIS.V1 + `/system/project/backProject?projectId=` + projectId,
        // url: APIS.V1 + `/system/project/backProject123456?projectId=` + projectId,
        method: 'GET'
    })
}
//
export function deleteByProjectId(projectId) {
    return request({
        url: APIS.V1 + `/system/project/deleteByProjectId?projectId=` + projectId,
        method: 'DELETE'
    })
}


// 待审查
export function waitReview(data) {
    return request({
        url: APIS.V1 + `/system/task/waitReview`,
        method: 'POST',
        data: data
    })
}

// 待尽调
export function waitDueDiligence(data) {
    return request({
        url: APIS.V1 + `/system/task/waitDueDiligence`,
        method: 'POST',
        data: data
    })
}
export function listTasks(params) {
    return request({
        url: APIS.V1 + `/system/task/listTasks`,
        method: 'POST',
        data: params
    })
}

//领取任务
export function receiveTask(taskId) {
    return request({
        url: APIS.V1 + `/system/task/receiveTask?taskId=` + taskId,
        method: 'GET',
    })
}

//待派件
export function deliverySend(data) {
    return request({
        url: APIS.V1 + `/system/task/deliverySend`,
        method: 'POST',
        data: data
    })
}
//待审批
export function approveCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/approveCheck`,
        method: 'POST',
        data: data
    })
}

//待确认
export function toBeComfirmed(data) {
    return request({
        url: APIS.V1 + `/system/task/toBeComfirmed`,
        method: 'POST',
        data: data
    })
}

//待签约
export function signCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/signCheck`,
        method: 'POST',
        data: data
    })
}

//待公证
export function notaryCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/notaryCheck`,
        method: 'POST',
        data: data
    })
}
//待公证
export function pledgeCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/pledgeCheck`,
        method: 'POST',
        data: data
    })
}

//待请款
export function loanCheck(data) {
    return request({
        url: APIS.V1 + `/system/task/loanCheck`,
        method: 'POST',
        data: data
    })
}
//补资料
export function fillMaterial(data) {
    return request({
        url: APIS.V1 + `/system/task/fillMaterial`,
        method: 'POST',
        data: data
    })
}
//退件提交
export function returnStepAdd(projectId, taskId) {
    return request({
        url: APIS.V1 + `/system/task/returnStepAdd?projectId=` + projectId + "&taskId=" + taskId,
        method: 'GET'
    })
}

//查询审批资料人员信息
export function getTaskCandiates(taskId) {
    return request({
        url: APIS.V1 + `/system/task/getTaskCandiates?taskId=` + taskId,
        method: 'GET',
    })
}

// 拒件列表
export function listProjectRejects(params) {
    return request({
        url: APIS.V1 + `/system/project/listProjectRejects`,
        method: 'POST',
        data: params
    })
}
// 搜索项目列表
export function searchProject(params) {
    return request({
        url: APIS.V1 + `/system/project/search`,
        method: 'GET',
        params: params
    })
}

// 查询派件人员
export function listRedePloyUser(roleName) {
    return request({
        url: APIS.V1 + `/system/user/listRedePloyUser?roleName=` + roleName,
        method: 'GET'
    })
}

// 查询补资料上一个节点状态
export function taskSupplementStatus(param) {
    return request({
        url: APIS.V1 + `/system/task/supplement/status`,
        method: 'GET',
        params: param
    })
}


export function findByProjectId(projectId) {
    return request({
        url: APIS.V1 + `/system/project/findByProjectId?projectId=` + projectId,
        method: 'get'
    })
}

//退件列表
export function backList (params) {
    return request({
        url: APIS.V1 + `/system/project/back/list`,
        method: 'POST',
        data: params
    })
}

//待核查
export function toBeVerified(data) {
    return request({
        url: APIS.V1 + `/system/task/toBeVerified`,
        method: 'POST',
        data
    })
}

//待终审
export function finalReview(data) {
    return request({
        url: APIS.V1 + `/system/task/finalReview`,
        method: 'POST',
        data
    })
}

export function capitalDetail(params) {
    return request({
        url: APIS.V1 + `/system/product/detail`,
        method:'get',
        params: params
    })
}

export function findCityList(params) {
    return request({
        url: APIS.V1 + `/system/product/choose/openCity`,
        method: 'get',
        params:params
    })
}

export function permissionList(params) {
    return request({
        url: APIS.V1 + `/system/user/list/permission`,
        method: 'get',
        params:params
    })
}
//审批结论详情
export function approvalDetail(params){
    return request({
        url: APIS.V1 + `/system/approval/conclusion/detail`,
        method: 'get',
        params:params
    })
}
//项目归属转移
export function projectTransfer(data){
    return request({
        url: APIS.V1 + `/system/project/transfer`,
        method: 'post',
        params:data
    })
}
